package com.hs.wdss.dwr;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.List;
import java.util.Map;

import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.CellStyle;

import com.hs.core.dwr.DwrHelper;

public class DataManagerDwr   extends DwrHelper{
	/**
	 * 删除古籍信息
	 * @param id
	 */
	public String deleteBook(String id){
		String isDelete = this.isDelete(id);
		String message = "";
		if(!"0".equals(isDelete)){
			message = "0";
		}else {
			this.getDbo().update("delete from wdss_resource where id=?", new Object[]{id});
			message = "1";
		}
		return message;
		
	}
	/**
	 * 检查该题录信息是否可删除
	 * @param id
	 * @return
	 */
	public String isDelete(String id){
		List accList = this.getDbo().queryList("select to_char(count(*)) as countnum from wdss_disinfo  where dsid=?", 
				new Object[]{id});
		Map data = (Map)accList.get(0);
		return (String)data.get("countnum");
	}
	
}
